home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-06-01 | 1.1 KB | 36 lines | [TEXT/GEOL] |
- Item 9465931 1-June-90 10:28PDT
-
- From: D0532 Aidea Systems, Don Park,PRT
-
- To: CPLUS.DEV$ C++ Interest List--Developers
- CPLUS.APPLE$ C++ Interest List--Apple Employees
-
- Sub: Re: C++ string initialization
-
- The problem seems to be caused by the way CFront translates variable
- initialization statement into an assignment statement.
-
- Following C++ code:
-
- typedef char stringType[32];
- stringType myOtherString = "Hello2";
-
- is tranlated into:
-
- typedef char stringType[32];
- stringType myOtherString; << Initialization removed!!!
- myOtherString = "Hello2"; << Replaced with assignment!!!
-
- which is not acceptable to C compiler.
-
- I am not sure what the story behind this is but there seems to be a
- work-around. Just put the initialization string within a block. i.e.
-
- stringType myOtherString = { "Hello2" };
-
- This seems to prevent CFront from breaking the statement up and is acceptable
- to C compiler as well.
-
- Don Park
-
-